package com.labor_management_system.Entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.sql.Timestamp;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

/**
 * 
 * @TableName attendance
 */
@TableName(value ="attendance")
@Data
//考勤
public class Attendance implements Serializable {
    /**
     * 
     */


    @JsonProperty("employeeId")
    private String employeeId;
    @JsonProperty("startWork")
    private Long startWork;
    @JsonProperty("endWork")
    private Long endWork;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    public Attendance(String id, long currentTime, long endTime) {
        setEmployeeId(id);setEndWork(endTime);setStartWork(currentTime);
    }


    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Attendance other = (Attendance) that;
        return (this.getEmployeeId() == null ? other.getEmployeeId() == null : this.getEmployeeId().equals(other.getEmployeeId()))
                && (this.getStartWork() == null ? other.getStartWork() == null : this.getStartWork().equals(other.getStartWork()))
                && (this.getEndWork() == null ? other.getEndWork() == null : this.getEndWork().equals(other.getEndWork()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getEmployeeId() == null) ? 0 : getEmployeeId().hashCode());
        result = prime * result + ((getStartWork() == null) ? 0 : getStartWork().hashCode());
        result = prime * result + ((getEndWork() == null) ? 0 : getEndWork().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", employeeId=").append(employeeId);
        sb.append(", startWork=").append(startWork);
        sb.append(", endWork=").append(endWork);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}